set :application, "lilei"

set :rails_env, "production"

set :repository,  "https://lilei.googlecode.com/svn/trunk/"
set :scm_username, "llleelay"
set :scm_password, "dK9Qx7Kw4AY8"

set :use_sudo, false

set :deploy_to, "/home/leelay/site/#{application}"
set :deploy_via, :remote_cache
set :user, "leelay"
set :password, "leelaykitty"

# If you aren't deploying to /u/apps/#{application} on the target
# servers (which is the default), you can specify the actual location
# via the :deploy_to variable:
# set :deploy_to, "/var/www/#{application}"

# If you aren't using Subversion to manage your source code, specify
# your SCM below:
# set :scm, :subversion

role :app, "scalise.dreamhost.com"
role :web, "scalise.dreamhost.com"
role :db,  "scalise.dreamhost.com", :primary => true

task :after_update_code, :roles => :app do
  run "chmod 700 #{release_path}/config/deploy.rb"
  run "chmod 700 #{release_path}/config/database.yml"
  # run "chmod -R 700 #{release_path}/db"

  run "cd #{release_path} && rake RAILS_ENV=#{rails_env} asset:packager:build_all"
end

desc "Restarting after deployment"
task :after_deploy, :roles => [:app, :db, :web] do
  run "sed 's/# ENV\\[/ENV\\[/g' #{deploy_to}/current/config/environment.rb > #{deploy_to}/current/config/environment.temp"
  run "mv #{deploy_to}/current/config/environment.temp #{deploy_to}/current/config/environment.rb"
end

